/**
* @author Ucar Sahin
*
* 03.06.2011
* IProtocolServiceAsync.java
* 
* TODO IProtocolServiceAsync.java:
*	TODO generate todo-liest if needed, else clear the todo-list
*/

package at.fhv.easyDietWeb.client.protocolService;

import java.util.Date;

import at.fhv.easyDietWeb.shared.util.ProtocolData;
import at.fhv.easyDietWeb.shared.util.wrappers.FoodListWrapper;
import at.fhv.easyDietWeb.shared.util.wrappers.MealTypesWrapper;
import at.fhv.easyDietWeb.shared.util.wrappers.UnitsWrapper;

import com.google.gwt.user.client.rpc.AsyncCallback;

/**
 * Corresponding asynchronous interface for the protocol related methods
 * @author Spiegel Philipp
 *
 */
public interface IProtocolServiceAsync
{
	/**
	 * sends all names of the meal types to the client
	 * @param callback
	 */
	void getMealTypes(AsyncCallback<MealTypesWrapper> callback);
	
	/**
	 * checks, if the dates are not in conflict with the time span of another nutritional journal
	 * @param from start date
	 * @param until end date
	 * @param callback response of the server
	 */
	void validateDates(Date from, Date until, AsyncCallback<Boolean> callback);
	
	/**
	 * calculates the number of days in the time span
	 * @param from start date
	 * @param until end date
	 * @param callback response of the server
	 */
	void getTimeSpan(Date from, Date until, AsyncCallback<Integer> callback);
	
	/**
	 * gets a list of all foods, which have the pattern + any wildcards in the name
	 * @param name patter for the food name
	 * @param callback response of the server
	 */
	void getFoodList(String name, AsyncCallback<FoodListWrapper> callback);
	
	/**
	 * gets all known units from the server
	 * @param callback response of the server
	 */
	void loadUnits(AsyncCallback<UnitsWrapper> callback);
	
	/**
	 * saves a protocol on the database
	 * @param protocol the protocol to be saved
	 * @param callback response of the server
	 */
	void saveProtocol(ProtocolData protocol, AsyncCallback<Boolean> callback);
}
